/*
 * Bsp_Key.c
 *
 *  Created on: Mar 28, 2025
 *      Author: Administrator
 */
#include "Bsp_Key.h"


static uint8_t Key1_State(){

	if(!(HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin))){

		return Key_Press;
	}
	return Key_Rlease;
}


uint8_t Key1_Mode_Set(uint8_t mode){

	uint8_t Press_Now = Key1_State();
	static uint8_t Press_Befor = 0;

	if(!Press_Now){
		Press_Befor = 0;
	}

	if(mode == Key_Always_Press && Press_Now){
		return Key_Press;
	}
	if(mode == Key_One_Press && Press_Now && !Press_Befor){
		Press_Befor = 1;
		return Key_Press;
	}
	return Key_Rlease;
}
